A sharpness function or a sharpness functional with the focal position as a variable is often applied to images with different focal positions for focussing. The sharpness functional then delivers a sharpness value for each focal position. Since it is not generally known beforehand how high the sharpness value is at the optimum focal position, a comparison with sharpness values at other focal positions is often carried out in order to ascertain the direction in which the focal position must be changed in order to arrive at the optimum focal position.
However, the problem is that at a greater distance of the focal position of the image, the sharpness functional often displays secondary maxima which can be caused by interferences during the recording or optical effects. Therefore, it may happen that such a secondary maximum is regarded as the optimum focal position, with the result that good focussing is not achieved.